package job.sxf;
import java.util.*;

public class sxf2 {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n = in.nextInt();
        int d = in.nextInt();
        int[] m = new int[n];
        int[] s = new int[n];
        for (int i = 0; i < n; i++){
            m[i] = in.nextInt();
            s[i] = in.nextInt();
        }
        int res = 0;
        for (int i = 0; i < n; i++){
            if (s[i] > res){
                res = s[i];
            }
        }
        System.out.println(res);
    }
}
